def isMatch(s):
    stack = []
    bracket_pairs = {')': '(', ']': '[', '}': '{', '>': '<', 
                     "'": "'", '"': '"', '`': '`'}
    quote_types = {'\'', '"', '`'}
    
    for char in s:
        if char in '([{<\'"`':
            stack.append(char)
        elif char in bracket_pairs:
            if not stack:
                return False
            top = stack.pop()
            if top != bracket_pairs[char]:
                return False
            # 处理引号不能交叉的情况（同类型引号需匹配）
            if char in quote_types and top != char:
                return False
    return not stack